#include "TcpServer.hpp"
#include "NetCal.hpp"
#include "IOservice.hpp"

// ./server 8899
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        std::cout << "指令错误" << std::endl;
    }
    uint16_t port = std::stoi(argv[1]);

    NetCal cal;

    IOservice service(std::bind(&NetCal::Caculator, &cal, std::placeholders::_1));

    std::shared_ptr<TcpServer> tsvr = std::make_shared<TcpServer>(
        std::bind(&IOservice::Excute, &service, std::placeholders::_1, std::placeholders::_2), 
        port
    );

    tsvr->loop();
    return 0;
}